package com.lee.learn.android.app.learnandroid;


import android.app.Fragment;
import android.app.FragmentManager;
import android.support.v13.app.FragmentPagerAdapter;

import java.util.Locale;

/**
 * Created by alex on 14-3-10.
 */
public class SectionsPagerAdapter extends FragmentPagerAdapter {

    public SectionsPagerAdapter(FragmentManager fm){
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        return SecondActivity.TabFragment.newInstance(position + 1);
    }

    @Override
    public int getCount() {
        return 3;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        Locale l = Locale.getDefault();
        switch (position){
            case 0:
                return "Section 1".toUpperCase(l);
            case 1:
                return "Section 2".toUpperCase(l);
            case 2:
                return "Section 3".toUpperCase(l);

        }
        return null;
    }
}
